#define DEBUG
#include <cstdio>

using namespace std;

const int maxm=100, maxk=500;
const long long inf=0x7fffffffffffffff;

long long calc(long long x) {
  return (x+1)*x/2;
}

long long min(long long a, long long b) {
  return a<b ? a : b;
}

int main() {
#ifdef DEBUG
  freopen("src.in", "r", stdin);
  freopen("src.out", "w", stdout);
#endif

  static int sum[maxm+1];
  static long long f[maxm+1][maxk+1];
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i=1; i<=n; i++) {
    int a;
    scanf("%d", &a);
    sum[a]++;
  }

  for (int i=1; i<=m; i++) {
    for (int j=0; j<=k; j++) {
      f[i][j] = inf;
      for (int x=0; x<=j; x++) {
	f[i][j] = min(f[i-1][j-x] + sum[i]%(x+1)*calc(sum[i]/(x+1)+1) + (x+1-sum[i]%(x+1))*calc(sum[i]/(x+1)), f[i][j]);
      }
    }
  }

  printf("%lld", f[m][k]);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
